package chapter11;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;

/**
 * Created by Caesar on 2015/12/29.
 */
public class ListIteration {
    public static void main(String[] args) {
        List<Integer> list1 = new ArrayList<Integer>(Arrays.asList(1,2,3,4,5));
        List<Integer> list2 = new ArrayList<Integer>();
        ListIterator<Integer> it = list1.listIterator();
        while (it.hasNext())
            it.next();
        while (it.hasPrevious())
            list2.add(it.previous());
        System.out.println(list2);
    }
}
